Skip to content

Conversation

@En-En-Code
Copy link

By switching to a negated look-ahead assertion, the new RegExp can easily detect double hyphens while also allowing a single hyphen at the end of a username. We don't lose the following character checked against [a-z\d] from the positive look-ahead assertion as this is covered by the earlier instance of this in the expression.

Added new unit test cases and updated README.md.

Resolves #4.

Also added new unit test cases to confirm proper behavior and updated README.md.
@Rudxain
Copy link

Rudxain commented Jan 20, 2025

What if it was a 2nd regex? That way, consumers can choose between either or both

@En-En-Code
Copy link
Author

I agree that the library would be more useful if it provided both, considering validating an existing account's username and a potential new account's username are different needs and this change would break the latter.
Unfortunately, there are a few outstanding issues, such as how it exports the regex, the new issue #7 with additional edge cases, and the author's absense from the project. which prevent this update and subsequent merge.
If you need whichever regex, just copy it from either this project's or my fork's index.js. I don't use this project directly (a little copy-paste is more managable than a little dependency).

@Rudxain
Copy link

Rudxain commented Jan 25, 2025

I don't use this project directly

Me neither, lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Does not match trailing dash

2 participants